#ifndef GITSERVER_H
#define GITSERVER_H

#include "singleton.h"
#include <QtCore/QObject>

class QAction;
class QSystemTrayIcon;
class GitDaemon;
class GitServerMain;
class SettingsDialog;

class GitServerCore : public QObject
{
    Q_OBJECT
    SINGLETON(GitServerCore);

public:
    GitDaemon* daemon() const;
    SettingsDialog* settingsDialog();
    QSystemTrayIcon* systemTrayIcon() const;

private slots:
    void onShow();
    void onShowSettings();
    void onDaemonStarted();
    void onDaemonStopped();
    void onMainWindowDestroyed();
    void onSettingsDialogDestroyed();

    void showMessage(const QString & msg);
    void showError(const QString & err);

private:
    void m_initGitDaemon();
    void m_gitDaemonIsRunning(bool running);
    void m_setMenu();
    void m_setDockMenu();

private:
    GitDaemon *m_gitDaemon;
    GitServerMain *m_mainWindow;
    SettingsDialog *m_settingsDialog;
    QAction *m_startAction;
    QAction *m_startDockAction;
    QAction *m_stopAction;
    QAction *m_stopDockAction;
    QSystemTrayIcon *m_systemTrayIcon;
};

#endif // GITSERVER_H
